<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改信息</title>
</head>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    ctxPath = /*[[@{/}]]*/ '';
    /*]]>*/
    function phoneCheck() {
        var phoneError = $("#phoneError");
        $.post({
            url:ctxPath+ "phoneCheck",
            data: {'phone': $("#phone").val()},
            success: function (data) {
                if (data.toString() === '') {
                    phoneError.css("color", "green")
                } else {
                    phoneError.css("color", "red")
                }
                phoneError.html(data);
            }
        });
    }
    function nameCheck() {
        var nameError = $("#nameError");
        $.post({
            url: ctxPath+"nameCheck",
            data: {'name': $("#name").val()},
            success: function (data) {
                if (data.toString() === '') {
                    nameError.css("color", "green")
                }
                else {
                    nameError.css("color", "red")
                }
                nameError.html(data);
            }
        });
    }

    function emailCheck() {
        var emailError = $("#emailError");
        $.post({
            url: ctxPath+"emailCheck",
            data: {'email': $("#email").val()},
            success: function (data) {
                if (data.toString() === '') {
                    emailError.css("color", "green")
                }
                else {
                    emailError.css("color", "red")
                }
                emailError.html(data);
            }
        });
    }

</script>
<body>
<form action="updateEmp"method="post" style="font-size: 20px">
    <input type="hidden" name="id" th:value="${Qemployee.getId()}">
    姓名：<input type="text" id="name" name="name" th:value="${Qemployee.getName()}" onblur="nameCheck()"><span id="nameError"></span><br>
    手机：<input type="text" id="phone" name="phone"th:value="${Qemployee.getPhone()}" onblur="phoneCheck()"><span id="phoneError"></span><br>
    邮箱：<input type="text" id="email" name="email"th:value="${Qemployee.getEmail()}" onblur="emailCheck()"><span id="emailError"></span><br>
    <input type="submit" value="修改" style="font-size: 20px">
</form>

</body>
</html>